package org.csmzxy.class2333;

class Calculator {
    public void performCalculation(int num1,int num2,char operation){
        class OperationCalculator{
            public int add(){
                return num1 + num2;
            }
            public int subtract(){
                return num1 - num2;
        }
    }
        OperationCalculator calculator = new OperationCalculator();
        if (operation == '+'){
            System.out.println("计算结果：" + calculator.add());
        }else if(operation == '-'){
            System.out.println("计算结果：" + calculator.subtract());
        }else {
            System.out.println("发生错误！");
        }
    }
}
